home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / CSMP Digests / csmp-v1-011.txt < prev    next >
Encoding:
Text File  |  1992-11-18  |  54.9 KB  |  1,544 lines  |  [TEXT/MPS ]

  1. C.S.M.P. Digest             Mon, 09 Mar 92       Volume 1 : Issue 11
  2.  
  3. Today's Topics:
  4.  
  5.      Serial Access
  6.     Summary on NuBus transfers
  7.     Casting Perl before Macintoshes
  8.     Summary: THINK C 5 oop method dispatcher address error
  9.     pbmplus (was: Need Info on PICT file format)
  10.     We fixed this
  11.      Flashing the edittext cursor
  12.      PKZIP summary and questions... (C source available)
  13.     ResEdit and the data fork
  14.     Blinking box on my screen
  15.     Writing a PICT from a offscreen grafport
  16.     Struct DInfo for ROOT Directory??
  17.     TEXT/styl resources -- HELP
  18.     Buggy Think C debugger?
  19.     Assemblers?
  20.     How to get address of (not pointer to) member function
  21.     How to hang up on a User
  22.  
  23.  
  24. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  25.  
  26. These digests are available (by using FTP, account anonymous, your email
  27. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  28. edu (try skinner.cs.uoregon.edu if that doesn't work).  This is also the home
  29. of the comp.sys.mac.programmer Frequently Asked Questions list.
  30.  
  31. The articles in these digests are taken directly from comp.sys.mac.programmer.
  32. They are not edited; all articles included in this digest are in their original
  33. posted form.  The only articles that are -not- included in these digests are
  34. those which didn't receive any replies (except those that give information
  35. rather than ask a question).  All replies to each article are concatenated
  36. onto the original article in the order in which they were received.  Article
  37. threads are not added to the digests until the last article added to the
  38. thread is at least one month old (this is to ensure that the thread is dead
  39. before adding it to the digests).
  40.  
  41. Send administrative mail to mkelly@cs.uoregon.edu.
  42.  
  43. -------------------------------------------------------
  44.  
  45. From: cshotton@oac.hsc.uth.tmc.edu (Chuck Shotton)
  46. Subject:  Serial Access
  47. Date: 22 Jan 92 21:15:25 GMT
  48. Organization: OAC, U of Texas Health Science Center
  49.  
  50. In article <61891@apple.Apple.COM>, han@Apple.COM (Byron Han) writes:
  51. [Original Question]
  52. > >        
  53. > Do NOT call _RAMSDOpen except for compatibility with 64K ROM machines.
  54. > Call _OpenDriver on the appropriate driver names.
  55. > 1) check to see if ARA port arbitration is installed.  if yes, go to step 4
  56.  
  57. How do you do step 1? (Is it even worth doing when System 6 is present?)
  58.  
  59. > 2) check to see if the driver is open (use _CRMIsDriverOpen)
  60. > 3) if yes, port is in use
  61. > 4) call _OpenDriver
  62. > 5) check error code
  63. > you should look up what serial driver-like objects there are in the system
  64. > using the code in the back of Inside Macintosh Communications Toolbox
  65.  
  66. Short of hard-coding tool names, there really isn't any way to determine what
  67. the transport layer of a tool is, so how do you propose that one check for a
  68. "serial driver-like" object? I could be overlooking something, but I seem
  69. to only be able to get info like the number of channels, reliability, etc.
  70. from a tool.
  71.  
  72. Chuck Shotton
  73.  
  74.  
  75.  
  76. ---------------------------
  77.  
  78. From: tagreen@bronze.ucs.indiana.edu (Todd Green)
  79. Subject: Summary on NuBus transfers
  80. Date: 23 Jan 92 19:32:52 GMT
  81. Organization: Indiana University
  82.  
  83.  
  84. I recently asked about maximizing NuBus transfer speeds from a
  85. software standpoint.  Unfortunately there seems to be little that you
  86. can do.  Here are the following messages that I received.  I've
  87. stripped the authors' names as I personally don't feel it's correct to
  88. post e-mail without the author's permission and I'm (frankly) to lazy
  89. to write each author and ask.  In the future I'll try to remember to
  90. ask if I can post.  Finally, a standard disclaimer that I'm not
  91. responsible for any information that is incorrect.
  92.  
  93. Well enjoy,
  94. Todd
  95. - -------start 1----------------
  96.   NuBus is a synchronous bus, so when the Mac CPU goes to write 
  97. on the NuBus, it must synch itself with the 10MHz clock.  Secondly, 
  98. no Mac today (even the Quadras) have the ability to perform block
  99. transfers between the CPU and NuBus (i.e. the CPU side doesn't have
  100. the necessary logic).  Therefore, NuBus block transfers don't do you
  101. any good when you are talking about programming the CPU.  The best
  102. you can do on a IIci is about 5MB/s through the Nubus using the CPU.
  103. On the Quadras, they've added a write buffer between the CPU and the
  104. NuBus, which increases the rate to about 8MB/s.
  105.  
  106.   Block transfers can only (at the moment) occur between two NuBus 
  107. cards (such as the 8/24GC and another video board).  In the original
  108. NuBus, a block transfer occurs when a NuBus master asserts signals
  109. indicating it's going to send up to 16 longwords in a continuous
  110. stream (one per clock) to a slave board.  There is an initial 
  111. assertion signal, and a subsequent acknowledge => 18 clocks total for
  112. the transaction, 2 for overhead, which works out to a max of about
  113. 35 MB/s between boards on the 10MHz clock.
  114.   In NuBus 90, the clock rate can be doubled, and blocks can be up to 
  115. 256 longwords.  This improves the overall bandwidth to very close to
  116. 80 MB/s.
  117.  
  118.   If you want to get into the technical details, you can ftp the NuBus
  119. 90 standard documents [IEEEP1196R] (which describe block transfers)
  120. from ftp.apple.com in the pub/standards directory.  While you're at
  121. it, you might also want to get the P1394 standards to see what Apple
  122. will be doing with serial connections on their machines in the future.
  123. - --------end 1 ----------------
  124. - --------start 2---------------
  125. NuBus block transfers are not supported by all cards, but for those
  126. that support it; write as much as possible in a run. (Only a long
  127. on 68k machines, a cache line on 68040. I don't think there's a
  128. way for applications to actually initiate bus block transfers itself;
  129. that's something that hardware does.)
  130.  
  131. You can never update an entire color screen during one refresh cycle
  132. over NuBus :-(
  133. - --------end 2 ----------------
  134. - --------start 3 --------------
  135. NuBus transfers information by passing an address, then data across a
  136. common set of 32 bus lines. "Block transfer" passes a single address to
  137. a the destination or source of the transfer, then passes sequential data
  138. transactions. Macs, unfortunately, do not support motherboard block-mode
  139. transfers, so it is only of use between NuBus cards, such as the 8*24 and
  140. 8*24GC which both support block mode slave and master transactions,
  141. respectively.
  142.  
  143.  
  144. A full description of NuBus, and its transactions appear in the Apple 
  145. Publication "Designing Cards and Drivers for the Macintosh Family"
  146. - -------end 3 -----------------
  147. - -------start 4 ---------------
  148. The simple answer is to buy a card that goes fast and use it in a system
  149. that drives it fast, there's almost nothing you can do in software ...
  150.  
  151. There are a number of cards that do 2 (Supermac's new ones ) or 3 (RasterOps)
  152. cycle NuBus cycles (2 is the least possible so the fastest possible NuBus
  153. cycle is 200nS or 5M writes/sec).
  154.  
  155. Next there are NO macs out there that generate NuBus block transfers or NuBus90
  156. block transfers (the Quadras have a NuBus90 bus but don't actually support any
  157. of the transfers). There are 3rd party cards that support block transfer, this
  158. is used almost entirely for video card to card. Most video cards from the major
  159. 3rd party vendors support block transfer as a slave (not NuBus90).
  160.  
  161. Older Macs took a LONG time to get onto and off of the bus so they are even
  162. slower too, as a rule even on the faster systems it takes on average 1/2
  163. NuBus clock to get access to the bus, if there is other traffic on it it
  164. may take much longer (arbitration takes 2 clocks min).
  165.  
  166. The one bright spot on the picture are the Quadras, they pipeline NuBus writes
  167. (ie the bus interface snarfs them from the CPU right away and tells it that
  168. it's done even though the data has not been written yet - the only bad side
  169. effect of this is that if you write to non-existant memory location then
  170. bus errors are broken), this means that some of the access delay can be avoided,
  171. in fact if you use the ('040 only) mov16 instruction you can get 4 back to
  172. back 2-cycle writes (with a fast card), mov16 requires both the source and
  173. destination be 16-byte aligned, and in 16-byte chunks.
  174.  
  175. In short there's not much you can do other than write the tightest, fastest
  176. code you possibly can in the lowest pixel depth you can get away with - and
  177. remember it will run faster on some cpus than others ...
  178. - --------end of last-----------
  179. -- 
  180. Internet: tagreen@bronze.ucs.indiana.edu
  181. NeXTMail: tagreen@cheyenne.ucs.indiana.edu
  182. BitNet:   tagreen@iubacs.bitnet
  183.  
  184.  
  185.  
  186. ---------------------------
  187.  
  188. From: neeri@iis.ethz.ch (Matthias Ulrich Neeracher)
  189. Subject: Casting Perl before Macintoshes
  190. Date: 24 Jan 92 04:08:55 GMT
  191. Organization: Integrated Systems Laboratory, ETH, Zurich
  192.  
  193.  
  194. A port of Perl to the Apple Macintosh is available by anonymous ftp to
  195. rascal.ics.utexas.edu, file ~ftp/mac/programming/Perl_402_MPW_CPT_bin
  196.  
  197. The file is 1.1M and must be transferred in BINARY mode. Please be considerate
  198. to RASCAL's users during CDT working hours. (And, no, there is no way to get
  199. it by email).
  200.  
  201. For European users, the file should soon appear on lth.se.
  202.  
  203. To make optimal use of all the features of this port, you should have
  204. MPW, ToolServer, and 5M of memory. There is also a standalone version
  205. included, but it's currently of very limited usefulness.
  206.  
  207. This package contains all of the sources for compilation with MPW C 3.2
  208.  
  209. Matthias
  210.  
  211. - ---
  212. Matthias Neeracher                                   neeri@iis.ethz.ch
  213.        IIS, ETHZ, and CH bear no responsibility for my actions.
  214.  
  215.  
  216.  
  217. ---------------------------
  218.  
  219. From: Pete.Gontier@p811.f70.n109.z1.FidoNet.Org (Pete Gontier)
  220. Subject: Summary: THINK C 5 oop method dispatcher address error
  221. Date: 17 Jan 92 02:04:14 GMT
  222.  
  223. Recently, I wrote:
  224.  
  225. > My app started getting an address error. [...]
  226. > I traced it down to a method call. Inside the method I put a Debugger, thinking
  227. > I could trace down my bug. Nope. Crash happens *as a result of the method
  228. > call*. The thread of execution never reaches the Debugger statement, which
  229. > is of course the first statement in the problem method.
  230.  
  231. > [...]
  232.  
  233. > The weirdest thing is that this crash only occurs when the THINK C debugger
  234. > is overseeing things. If I turn it off, I have no problems. If I could
  235. > reproduce the crash with MacsBug only, I'd have traced this down already.
  236.  
  237. Despite the suggestions of several well-intentioned and articulate people,
  238. this turned out to be the simplest fix of them all. I rebuilt everything.
  239.  
  240. Someone suggested it was possible that in an OOP context THINK C 5 can get
  241. confused about headers and definitions and that sort of thing. Since this is
  242. my second OOP project (the first wasn't even serious), I tend to move things
  243. around an awful lot. So if it were possible for the compiler's idea of what's
  244. where to get confused, I wouldn't be surprised if I created the conditions.
  245.  
  246. I would like to think that I don't ever try to solve problems with voodoo
  247. like this, and it's a little disturbing to do so. I thought I was a
  248. professional! :-)
  249.  
  250. Most of the suggestions took the form of "Probably the memory manager is
  251. moving an object when you don't expect it to -- objects *are* handles, you
  252. know." Well, yes, I do know, grumble grumble. Here's the method call:
  253.  
  254.    void oApplication::Run(void) {
  255.       this->eLoop->Loop( );
  256.    }
  257.  
  258. As you can see, this is pretty simple stuff. I suppose there could be
  259. something wrong with the oApplication object, but I can't imagine the
  260. thread of execution would ever arrive at oApplication::Run if it were.
  261.  
  262. Nevertheless, the advice is useful. I can construct any number of situations
  263. in which a moved handle results in a bad method call.
  264.  
  265. Anyway, tanx for all the help, folx.
  266.  * Origin: EC Technology, Santa Barbara, CA (1:109/70.811)
  267.  
  268.  
  269.  
  270. ---------------------------
  271.  
  272. From: lsr@Apple.COM (Larry Rosenstein)
  273. Subject: pbmplus (was: Need Info on PICT file format)
  274. Date: 24 Jan 92 01:32:13 GMT
  275. Organization: Object Based Systems, Apple Computer, Inc.
  276.  
  277. In article <1992Jan20.043131.26776@cs.ubc.ca> phillips@cs.ubc.ca (George Phillips) writes:
  278. >
  279. >As usual, the PBM+ image utilities have both PICT to PPM and PPM to PICT
  280. >converters.  Your question reminded me that I have a newer version
  281. >of the PICT to PPM converter to post.
  282.  
  283. I have been playing around with porting the pbmplus utilities to the Mac
  284. under MPW.  The current status is that I have a set of files that you can
  285. use to do the port, and I've sent them to a few people to try out.  I've
  286. only gotten one response, which seemed to be positive, so I thought I would
  287. mention it here.
  288.  
  289. To use this, you need MPW and MPW C version 3.2 (it may be possible to get
  290. it working with 3.1, but you will have to change the compilation flags).
  291. You also need to obtain the pbmplus sources yourself, from one of the
  292. archive sites.  You can optionally get the JPEG conversion sources, which
  293. are available separately.
  294.  
  295. The porting kit is on ftp.apple.com, in /pub/lsr.  It consists of the files
  296. you need to add to make it possible to build the tools.  Specifically, it
  297. consists of a couple of scripts to convert the UNIX-style makefiles to
  298. MPW-style, and a couple of header files to substitute for UNIX-related ones.
  299.  
  300. It takes about 2 hours to build everything on a Mac II.  (You can cut this
  301. down by limiting what you build.)  The resulting tools can be piped together
  302. and will run in the background under MPW.  
  303.  
  304. If you do try this out, please send me reports of problems, comments, etc.
  305. I already know that a couple of the files will give you compiler errors, but
  306. these are easily fixable.  (My philosophy has been to avoid changing the
  307. original sources, but to work around incompatibilities.)
  308.  
  309.  
  310. -- 
  311. Larry Rosenstein, Apple Computer, Inc.
  312.  
  313. lsr@apple.com
  314. (or AppleLink: Rosenstein1)
  315.  
  316.  
  317.  
  318. ---------------------------
  319.  
  320. From: harris@ranger.enet.dec.com (ranger::harris)
  321. Subject: We fixed this
  322. Date: 24 Jan 92 05:00:40 GMT
  323. Organization: Digital Equipment Corporation
  324.  
  325.  
  326.     Re: "jjohnson@ewsvax.mdcbbs.com" 
  327.         -< FSOpen problem with Pathworks/Appleshare >-   
  328.     
  329. >    Now for the interesting part... If the pathname is fed to MSWord, (via
  330. >    use of the Hypercard "open <file> with <app>")it will open the file.
  331. >    After Word has opened the file once, the FSOpen *works*!!!!!! Can
  332. >    someone shed some light on why this is the case, and how we can open
  333. >    the file directly?
  334. >
  335. >    We're using Pathworks 1.0, Think Pascal 4.0, System 6.0.5 & 7 on
  336. >    IIcx's.
  337.     
  338.     I suggest that you contact your Digital support and request the latest
  339.     ECO against the file server, or wait for V1.1 to begin shipping (which
  340.     "if you know what doesn't freeze over", should start happening later this
  341.     month :-)
  342.     
  343.     The problem is that when you tried to open the file the first time with
  344.     the full pathname, the file had never been seen before by the file
  345.     server.  When you used MS-Word, MS-Word mostly actually performed an
  346.     enumeration of the directory causing the file server to do a wildcard
  347.     lookup of the huge directory and see the new file.  Upon seeing the new
  348.     file, the file server cataloged it and you could open it with the full
  349.     pathname after that.
  350.     
  351.     This was reported to engineering several months ago and fixed in an ECO
  352.     available from Digital Customer Serivce Centers around the world.  If
  353.     you try the latest ECO and it doesn't work, then contact your Digital
  354.     Customer Support Center and have them QAR this problem to PATHWORKS for
  355.     Macintosh engineering.
  356.     
  357.                         Bob Harris
  358.                         Digital Equipment Corporation
  359.  
  360.  
  361.  
  362. ---------------------------
  363.  
  364. From: greggor@Apple.COM (Greg L. Anderson)
  365. Subject:  Flashing the edittext cursor
  366. Date: 24 Jan 92 19:42:33 GMT
  367. Organization: Apple Computer Inc., Cupertino, CA
  368.  
  369. In article <1992Jan24.030618.2120@zorch.SF-Bay.ORG> mike@zorch.SF-Bay.ORG (Mike Smithwick) writes:
  370. >Is there some mysterious global that simply points to the currently active
  371. >item?? (oh please, oh please, oh please.........)
  372.  
  373. Yes, ((DialogRecord*)dlog)->textH.  Of  course, this value probably
  374. won't be valid if your dialog doesn't have any editText items in it (:>),
  375. so user-discression is advised.
  376.  
  377. Also, I've noticed that this value doesn't seem to be valid until
  378. some dialog manager calls have been made (GetDItem does the trick
  379. for me).
  380.  
  381. -- 
  382. =====================   ===========================   =====================
  383. Greg Anderson           Apple Computer, Inc.            O    Ponnuki    O
  384. Macintosh Bodhisattva   Developer Tools Engineering    O O  is  ideal  O O
  385. greggor@apple.com       Apple Developer Suite           O     shape     O
  386. =====================   ===========================   =====================
  387.  
  388.  
  389.  
  390. ---------------------------
  391.  
  392. From: johnston@me.udel.edu (Bill Johnston)
  393. Subject:  PKZIP summary and questions... (C source available)
  394. Date: 24 Jan 92 19:44:00 GMT
  395. Organization: University of Delaware/Department of Mechanical Engineering
  396.  
  397. In article <24JAN199201203018@me.udel.edu>, johnston@me.udel.edu (William Johnston) writes...
  398.  
  399. >"ZIP" describes a certain set of related file compression schemes.
  400.  
  401. >Public ZIP from the INFO-ZIP project has been ported to
  402. >PC and Unix and is available in source form for porting to the Mac,
  403. >should anyone have the inclination to do so.
  404.  
  405. I have gotten a few requests for the source code, which was originally
  406. posted to one of the USENET *.sources groups.  It's been un-"tar.Z"ed,
  407. run through a newlines converter, and set up with creator code for
  408. Think C.  I'm willing to e-mail a copy of the source to anyone who
  409. is interested in playing with the code, or considering porting ZIP
  410. to the Macintosh, or just interested in the INFO-ZIP project.
  411.  
  412. Background:
  413.  
  414. For those who are interested:  "ZIP" format refers to a set of 
  415. efficient file compression algorithms (roughly similar to Compact Pro
  416. in speed and percent saved).  The archive format has been placed
  417. in the public domain, and there are both commercial and public
  418. implementations available on other platforms (Unix and MS-DOS).
  419.  
  420. The INFO-ZIP project recently released a freeware version of ZIP
  421. with source code in C.  It has been ported for many variants of 
  422. Unix and unix-like operating systems.  A Macintosh version would
  423. make for a very significant contribution to the Mac programming
  424. community, particularly for those who have an interest in cross-
  425. platform development and data sharing -- which are certain to become
  426. increasingly important as Mac OS, Windows, and Apple-IBM joint
  427. efforts make the slow but inevitable move toward open standards.
  428.  
  429. Disclaimer:  I have no connection with the INFO-ZIP project other
  430. than having a basic interest in platform-independent development
  431. issues.  The list of contributors to public ZIP is very long;
  432. I'll send the whole package in ".cpt.hqx" format to anyone
  433. who is interested.
  434.  
  435. -- Bill (johnston@me.udel.edu)
  436.  
  437.  
  438.  
  439. ---------------------------
  440.  
  441. From: dce@smsc.sony.com (David Elliott)
  442. Subject: ResEdit and the data fork
  443. Date: 3 Feb 92 04:54:09 GMT
  444. Organization: Sony Microsystems Corp, San Jose, CA
  445.  
  446. I realize that ResEdit is for resources, but wouldn't it be nice if
  447. it could also edit the data fork?  Even with just the standard Hex
  448. template, it would be better than trying to find some damned program
  449. that would let me edit the binary data.
  450.  
  451.  
  452.  
  453. - -------------------------
  454.  
  455. From: jess@gn.ecn.purdue.edu (Jess M Holle)
  456. Subject:  ResEdit and the data fork
  457. Date: 3 Feb 92 23:42:59 GMT
  458. Organization: Purdue University Engineering Computer Network
  459.  
  460. I strongly agree with the previous poster's request for a hex editor for
  461. the data fork of Mac files. I presently have no tool to edit the data
  462. fork. Does anyone know of a free/shareware data fork editor that is System
  463. 7.1 (with Tuneup) compatible?
  464.  
  465. Jess Holle
  466.  
  467.  
  468.  
  469. - -------------------------
  470.  
  471. From: Carl.Constantine@BCSystems.GOV.BC.CA
  472. Subject:  ResEdit and the data fork
  473. Date: 5 Feb 92 12:45:39 -0800
  474. Organization: BC Systems Corporation
  475.  
  476. In article <1992Feb3.234259.13903@gn.ecn.purdue.edu>, jess@gn.ecn.purdue.edu (Jess M Holle) writes:
  477. > I strongly agree with the previous poster's request for a hex editor for
  478. > the data fork of Mac files. I presently have no tool to edit the data
  479. > fork. Does anyone know of a free/shareware data fork editor that is System
  480. > 7.1 (with Tuneup) compatible?
  481.  
  482. I use FileEdit.  It comes with MacTools Deluxe 1.2.  I know it's not free,
  483. actually I beleive MacSnoop 1.4.4 is exaclty the program you're looking for.  I
  484. recently saw it on an anonymous FTP site (either Sumex [36.44.0.6],
  485. Rascal.ics.utexas.edu [128.83.138.20] or Mac.archive.umich.edu
  486. [141.211.164.153]). You could try these sites and let me know if it's there and
  487. if that's what you want.
  488.  
  489. -- 
  490.  
  491. Carl.Constantine@BCSystems.gov.bc.ca
  492. British Columbia, Canada
  493.  
  494.  
  495.  
  496.  
  497. - -------------------------
  498.  
  499. From: Thad.Humphries@p950.f70.n109.z1.FidoNet.Org (Thad Humphries)
  500. Subject:  ResEdit and the data fork
  501. Date: 7 Feb 92 00:50:55 GMT
  502.  
  503.  
  504.  --> From: Carl.Constantine@BCSystems.GOV.BC.CA
  505.  --> Newsgroups: comp.sys.mac.programmer
  506.  --> Organization: BC Systems Corporation
  507.  --> 
  508.  --> In article <1992Feb3.234259.13903@gn.ecn.purdue.edu>,
  509.  --> jess@gn.ecn.purdue.edu (Jess M Holle) writes:
  510.  --> > I strongly agree with the previous poster's request for a hex editor
  511.  --> for
  512.  --> > the data fork of Mac files. I presently have no tool to edit the data
  513.  --> > fork. Does anyone know of a free/shareware data fork editor that is
  514.  --> System
  515.  --> > 7.1 (with Tuneup) compatible?
  516.  --> 
  517.  --> I use FileEdit.  It comes with MacTools Deluxe 1.2.
  518.  
  519. My grip with FileEdit is that it writes a full 512 byte sector even when you just want to write 30 or so bytes.  Try using it to set the data fork of MS Word 4.0 to zero after some office jerk registered the VP's copy to "Yo Mama" or some such trash.  You get a registered to splash screen as long as the page!  For mucking with data forks, Fedit is the best.  Too bad nothing came of it after the author went commerical...
  520.  
  521.  * Origin: Quis custodiet ipsos custodes? (1:109/70.950)
  522.  
  523.  
  524.  
  525. ---------------------------
  526.  
  527. From: david@oahu.cs.ucla.edu (David Dantowitz)
  528. Subject: Blinking box on my screen
  529. Date: 4 Feb 92 19:57:26 GMT
  530. Organization: UCLA Computer Science Department
  531.  
  532.  
  533. I have an interesting problem: occasionally I get a blinking
  534. box with a hole in it, in the middle of my screen.  It looks like
  535. this:
  536.  
  537.                                *****************
  538.                                ********    *****
  539.                                *****************
  540.  
  541.  
  542. What am I doing in my app?  I increase the stack to 56k:
  543. SetApplLimit(GetApplLimit()-32*1024)
  544.  
  545. Then I do lots of interesting stuff and eventually use the SCSIManager
  546. to write data to a tape unit (an Exabyte).
  547.  
  548. Any clues?  I'm using a IIci, System 7.0.1 (NO tune up yet) and 
  549. Think C 5.0.1.
  550.  
  551. Hey, one more question... If I mark the stack with a specific 
  552. pattern just after the call to SetApplLimit above, and THEN I
  553. check the stack's contents, would this be a good way to determine
  554. how much stack I'm using?  Also, can the Mac use UNUSED portions
  555. of the stack (between A7 and the ApplLimit) for random storage?
  556. [I'm getting some strange data written to the UNUSED portions
  557. of the stack, and I'm curious if my APP is misbehaving or if
  558. the Mac OS can write to that stack space when it is not used.]
  559.  
  560. Also, (a FAQ) how does one catch memory leaks with the Mac's
  561. non-protected memory?
  562.  
  563. Thanks.
  564. -- 
  565. David Dantowitz
  566. david@cs.ucla.edu
  567.  
  568. Singing Barbershop when I'm not computing...
  569.  
  570.  
  571.  
  572. - -------------------------
  573.  
  574. Organization: Johannes Kepler University Linz - Computing Center
  575. Date: Wednesday, 5 Feb 1992 08:55:30 CET
  576. From: Norbert Mueller <K360171@ALIJKU11.BITNET>
  577. Subject:  Blinking box on my screen
  578.  
  579. I recently had the blinking box problem, I could get rid of it by replacing
  580. the disk driver of my newly acquired Liberty (Conner) 120MB portable disk
  581. with a different brand. I am not 100% sure it was the drivers fault but the
  582. problem has not occured any more since removing that Apollyonics SCSI Director.
  583.  
  584. Norbert Mueller
  585.  
  586.  
  587.  
  588. - -------------------------
  589.  
  590. From: ksand@apple.com (Kent Sandvik)
  591. Subject:  Blinking box on my screen
  592. Date: 6 Feb 92 23:01:37 GMT
  593. Organization: MacDTS Mongols
  594.  
  595. In article <1992Feb4.195726.19386@cs.ucla.edu>, david@oahu.cs.ucla.edu (David Dantowitz) writes:
  596. > I have an interesting problem: occasionally I get a blinking
  597. > box with a hole in it, in the middle of my screen.  It looks like
  598. > this:
  599. >                                *****************
  600. >                                ********    *****
  601. >                                *****************
  602. > What am I doing in my app?  I increase the stack to 56k:
  603. > SetApplLimit(GetApplLimit()-32*1024)
  604.  
  605. > Then I do lots of interesting stuff and eventually use the SCSIManager
  606. > to write data to a tape unit (an Exabyte).
  607.  
  608. Maybe it's something inside the Exabyte driver used for testing
  609. (blitting bytes on the screen during debugging, and the code
  610. is still there)?
  611.  
  612. > Hey, one more question... If I mark the stack with a specific 
  613. > pattern just after the call to SetApplLimit above, and THEN I
  614. > check the stack's contents, would this be a good way to determine
  615. > how much stack I'm using?  Also, can the Mac use UNUSED portions
  616. > of the stack (between A7 and the ApplLimit) for random storage?
  617. > [I'm getting some strange data written to the UNUSED portions
  618. > of the stack, and I'm curious if my APP is misbehaving or if
  619. > the Mac OS can write to that stack space when it is not used.]
  620.  
  621. I think that you always have problems finding out the exact
  622. size of the stack, it changes all the time, all you could do
  623. is to take snapshots at a common place in the WaitNextEvent loop,
  624. and possibly adjust the stack size dynamically. Or then keep
  625. a log of stack space use, and depending on the empirical data 
  626. allocate more stack size in the beginning of the program.
  627.  
  628. There are applications that create temporary stacks for internal
  629. use, but I don't think they should mess around with the real 
  630. application stack.
  631.  
  632.  
  633. > Also, (a FAQ) how does one catch memory leaks with the Mac's
  634. > non-protected memory?
  635.  
  636. With patience... Actually I think the elimination method is the
  637. fastest way to shake out the sucker code. Also check out the
  638. Leak dcmds on the developer CD (and I think those are on ftp.apple.com
  639. as well, but I'm not 100% sure).
  640.  
  641. Sade 1.4 and Steve Jasik debuggers have an option to memory protect
  642. code with the MMU chip, and the debuggers might inform when the memory
  643. changes (for instance protecting the ApplLimit lmg).
  644.  
  645.  
  646. Kent Sandvik
  647.  
  648.  
  649.  
  650. - -------------------------
  651.  
  652. From: changm@cs.umn.edu (Ming-Tsung Darda Chang)
  653. Subject:  Avoid using Multi-Finder!!
  654. Date: 6 Feb 92 06:03:34 GMT
  655. Organization: University of Minnesota, Minneapolis, CSci dept.
  656.  
  657. In article <1992Feb6.051729.11436@cco.caltech.edu> dougm@descartes.cns.caltech.edu (Doug McNaught) writes:
  658. >In article <1992Feb6.034404.19643@cs.umn.edu> changm@cs.umn.edu (Ming-Tsung Darda Chang) writes:
  659. >>Hi, Folks:
  660. >>
  661. >>I really need some helps or any hint to avoid using Multi-Finder when running 
  662. >>my program!!  I have been reading through the Tech. notes, 
  663. >>Inside Macintosh I-VI, but still can not help me come up with any idea.  
  664. >>I do hope any expert there can give me any kind of help to make my program work 
  665. >>on Multi-Finder without using Multi-Finder!!
  666. >
  667. > I'm not sure exactly what you mean. If you want to refuse to run under MF, 
  668. >there is no 'official' way to know whether MF is active or not. Otherwise, I
  669. >can't puzzle out your prose--could you clarify?
  670. >doug
  671. What I intend to do is to write a login program which will force the users to
  672. enter their usernames and passwords.  You will see the problem if my program
  673. runs under Multi-Finder!
  674.  
  675. I used WaitNextEvent to implement it, but still failed to do so!  I will click
  676. the outside of the login program to get access to the computers without
  677. entering the usernames and passwords.  That makes the login program useless!
  678.  
  679. I do appreciate if you have any idea!
  680.  
  681. Thanks!
  682.  
  683. Darda
  684. -- 
  685. ========================================================================
  686. = Mr. Ming-Tsung Darda Chang                                           = 
  687. =----------------------------------------------------------------------=
  688. = Computer Science Department              Internet: changm@cs.umn.edu =
  689.  
  690.  
  691.  
  692. - -------------------------
  693.  
  694. From: csuley@cs.cornell.edu (Christopher Suley)
  695. Subject:  Avoid using Multi-Finder!!
  696. Organization: Cornell Univ. CS Dept, Ithaca NY 14853
  697. Date: Thu, 6 Feb 1992 15:58:57 GMT
  698.  
  699. In article <1992Feb6.060334.28315@cs.umn.edu>
  700. changm@cs.umn.edu (Ming-Tsung Darda Chang) writes:
  701. >What I intend to do is to write a login program which will force the users to
  702. >enter their usernames and passwords.  You will see the problem if my program
  703. >runs under Multi-Finder!
  704. >
  705. >I used WaitNextEvent to implement it, but still failed to do so!  I will click
  706. >the outside of the login program to get access to the computers without
  707. >entering the usernames and passwords.  That makes the login program useless!
  708. >
  709. >I do appreciate if you have any idea!
  710. >
  711. >Thanks!
  712. >
  713. >Darda
  714.  
  715. If you implement the login program using a modal dialog box, you can solve
  716. the problem very simply.
  717.  
  718. MultiFinder does not allow an application to be switched into the background
  719. while it is displaying a modal dialog box.
  720.  
  721. Hope this helps!
  722. -- 
  723. {}-{}-{}-{}-{}-{}-{}-{}-{}-{}
  724. {} Christopher S. Suley    {}
  725. {} csuley@cs.cornell.edu   {}
  726. {}-{}-{}-{}-{}-{}-{}-{}-{}-{}
  727.  
  728.  
  729.  
  730. - -------------------------
  731.  
  732. From: david@oahu.cs.ucla.edu (David Dantowitz)
  733. Subject:  Blinking box on my screen
  734. Organization: UCLA Computer Science Department
  735. Date: Fri, 7 Feb 92 18:44:27 GMT
  736.  
  737.  
  738. Thanks for the information.
  739.  
  740. The exabyte driver is not the source of the box shape, because I wrote it
  741. and used no graphics (just calls to the SCSI manager).
  742.  
  743. BUT, the problem has been non-existent for the past 12 hours!!
  744.  
  745. What was once easily reproducable has stopped.
  746.  
  747. An earlier posting (and mail correspondance) indicated that one other
  748. person had seen something similar.  What we had in common was that we
  749. were both using the Apployonics disk driver.  When replaced with
  750. SilverLining 5.31 the problem went away (So far, anyway.)
  751.  
  752. Next week I'll give them a call (as well as trying to see if I
  753. have a leak in my software)
  754.  
  755. Thanks for the advice
  756.  
  757. David
  758.  
  759. p.s. is it still valid to set memory location 0 to 'NIL!' to trap
  760. invalid defs?
  761.  
  762. -- 
  763. David Dantowitz
  764. david@cs.ucla.edu
  765.  
  766. Singing Barbershop when I'm not computing...
  767.  
  768.  
  769.  
  770. ---------------------------
  771.  
  772. From: cmp9133@sys.uea.ac.uk (A.C. Lock)
  773. Subject: Writing a PICT from a offscreen grafport
  774. Date: 5 Feb 92 17:03:53 GMT
  775. Organization: UEA, Norwich, UK
  776.  
  777. I have an offscreen colour grafport, and I wish to write it out to file
  778. in PICT format. From various sources I know I have to write 512 zeros,
  779. OpenPicture, CopyBits the pixmap to itsself and then ClosePicture. After this
  780. I can write the contents of the picHandle. What are the contents of the
  781. picHandle, and how long are they ?
  782.  
  783. I dont want to use bottle necks or anything, I just want to do a simple
  784. FSWrite which writes the entire pixmap in one go. Is this possible ?
  785.  
  786. Yours 
  787.  
  788. Adam Lock
  789.  
  790.  
  791.  
  792. - -------------------------
  793.  
  794. From: peirce@outpost.SF-Bay.org (Michael Peirce)
  795. Subject:  Writing a PICT from a offscreen grafport
  796. Date: 7 Feb 92 01:59:25 GMT
  797. Organization: Peirce Software
  798.  
  799.  
  800. In article <2138@sys.uea.ac.uk> (comp.sys.mac.programmer), cmp9133@sys.uea.ac.uk (A.C. Lock) writes:
  801. > I have an offscreen colour grafport, and I wish to write it out to file
  802. > in PICT format. From various sources I know I have to write 512 zeros,
  803. > OpenPicture, CopyBits the pixmap to itsself and then ClosePicture. After this
  804. > I can write the contents of the picHandle. What are the contents of the
  805. > picHandle, and how long are they ?
  806. > I dont want to use bottle necks or anything, I just want to do a simple
  807. > FSWrite which writes the entire pixmap in one go. Is this possible ?
  808.  
  809. Simply use GetHandleSize to figure out how big the pict handle is and use
  810. that size to write the data in the handle.  You don't have to worry
  811. about what's inside the picHandle.  You're on the right track here.
  812.  
  813. --  Michael Peirce         --   peirce@outpost.SF-Bay.org
  814. --  Peirce Software        --   Suite 301, 719 Hibiscus Place
  815. --  Macintosh Programming  --   San Jose, California USA 95117
  816. --           & Consulting  --   voice: (408) 244-6554 fax: (408) 244-6882
  817. --                         --   AppleLink: peirce & America Online: AFC Peirce
  818.  
  819.  
  820.  
  821. ---------------------------
  822.  
  823. From: rleung@csws4.ic.sunysb.edu (Ross H Leung)
  824. Subject: Struct DInfo for ROOT Directory??
  825. Date: 6 Feb 92 17:19:46 GMT
  826. Organization: State University of New York at Stony Brook
  827.  
  828. Hello,                                                                          
  829.    How do you get FINDER information about the ROOT directory itself            
  830. about the finder's window rect and view type?  I can get the window             
  831. rect (from DInfo structure) by using PBGetCatInfo for any directory             
  832. in a volume BUT NOT the ROOT directory?                                         
  833.  
  834. Please reply to:
  835.   RLEUNG @ ic.sunysb.edu
  836.  
  837. Ross Leung
  838. Instructional Computing
  839. University at Stony Brook, NY
  840.  
  841.  
  842.  
  843. - -------------------------
  844.  
  845. From: grobbins@Apple.COM (Grobbins)
  846. Subject:  Struct DInfo for ROOT Directory??
  847. Date: 7 Feb 92 03:42:53 GMT
  848. Organization: Apple DTS
  849.  
  850. In article <1992Feb6.171946.11598@sbcs.sunysb.edu> rleung@csws4.ic.sunysb.edu (Ross H Leung) writes:
  851. >   How do you get FINDER information about the ROOT directory itself 
  852. >about the finder's window rect and view type?  I can get the window
  853. >rect (from DInfo structure) by using PBGetCatInfo for any directory
  854. >in a volume BUT NOT the ROOT directory?
  855.  
  856. PROGRAM GetRootRect;
  857. USES Files;
  858. CONST kFirstDriveMountedVRefNum = -1;
  859. VAR
  860.   retCode: OSErr;
  861.   myCInfoPBRec: CInfoPBRec;
  862.   nameStr: Str255;
  863. BEGIN
  864.   WITH myCInfoPBRec DO
  865.     BEGIN
  866.       ioCompletion := NIL;
  867.       ioNamePtr := @nameStr;
  868.       ioVRefNum := kFirstDriveMountedVRefNum; { boot drive }
  869.       ioDrDirID := fsRtDirID; { root has dirID 2; see Files header file }
  870.       ioFDirIndex := 0;
  871.       ioFVersNum := 0; { MFS compatibility, per Tech Note 204 }
  872.     END;
  873.   retCode := PBGetCatInfoSync(@myCInfoPBRec); { Inside Mac IV chapter 19 }
  874.   IF retCode <> noErr THEN WriteLn('Error: PBGetCatInfo returned ', retCode)
  875.   ELSE WITH myCInfoPBRec.ioDrUsrWds.frRect DO
  876.     WriteLn('root window rect: ', left, ' ', top, ':', right, ' ', bottom);
  877. END.
  878.  
  879. I cannot think of a good reason for needing this information about the
  880. Finder windows.  Please don't try to position icons; that is best left
  881. to the Finder (by clearing the hasBeenInited bit of the file's Finder
  882. flags. The bit documented in chapter 9 of Inside Mac VI.)  Remember also
  883. that the Finder caches ruthlessly, so the values obtained from disk
  884. may not be current.
  885.  
  886. Grobbins             grobbins@apple.com
  887.  
  888. Usual disclaimers apply.
  889.  
  890.  
  891.  
  892. ---------------------------
  893.  
  894. From: pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger)
  895. Subject: TEXT/styl resources -- HELP
  896. Organization: Yale University, Department of Computer Science, New Haven, CT
  897. Date: Thu, 6 Feb 1992 23:55:16 GMT
  898.  
  899. Hi.
  900.  
  901. How does one unpack the TEXT/styl resources created by ResEdit into
  902. their corresponding data structures in memory for use by a program?
  903. Are the structure of these resources documented anywhere?  Etc.
  904.  
  905. Thanks,
  906. LP
  907.  
  908. -- 
  909.  
  910. Laurence A. Pittenger
  911. CSNET  : pittenger-laurence@cs.yale.edu
  912. BITNET : pitlaua@yalevm ,  pittenger-laurence@yalecs
  913.  
  914.  
  915.  
  916. - -------------------------
  917.  
  918. From: pittenger-laurence@CS.YALE.EDU (Laurence Arthur Pittenger)
  919. Subject:  TEXT/styl resources -- CODE
  920. Date: 7 Feb 92 16:17:35 GMT
  921. Organization: Yale University, Department of Computer Science, New Haven, CT
  922.  
  923.  
  924. Thanks to everyone who responded. (Ok, I know it was a simple
  925. question, but still...)
  926.  
  927. the following is adapted from a note sent to me by Andre Srinivasan at
  928. Pitt.  Thanks Andre!
  929.  
  930.  
  931. - ------------------------------------------------------
  932.  
  933. Handle        textH, styleH;
  934. TEHandle    textEditH;
  935. int        resID;
  936.  
  937. //
  938. // Set up textEdit Handle first
  939. //
  940.  
  941. // Make sure we have some text to add
  942. texH = GetResource('TEXT', resID);
  943. if (textH != NULL)
  944. {
  945.    // Clear the current text in textEditH
  946.    TESetSelect (0,32767, textEditH);
  947.    TEDelete (textEditH);
  948.  
  949.    // Get the corresponding style stuff from the resource (it's ok if
  950.    //  it's NULL)
  951.    styleH = GetResource('styl', resID);
  952.   
  953.    // Insert it into the textEdit fields
  954.    HLock (textH);
  955.    TEStylInsert(*textH, SizeResource(textH), styleH, textEditH);
  956.    HUnlock(textH);
  957.  
  958.    //Clean Up
  959.    ReleaseResource (textH);
  960.    ReleaseResource (styleH)
  961. }
  962.  
  963.  
  964.  
  965. -- 
  966.  
  967. Laurence A. Pittenger
  968. CSNET  : pittenger-laurence@cs.yale.edu
  969. BITNET : pitlaua@yalevm ,  pittenger-laurence@yalecs
  970.  
  971.  
  972.  
  973. ---------------------------
  974.  
  975. Subject: Buggy Think C debugger?
  976. From: russells@ccu1.aukuni.ac.nz (Russell Street)
  977. Date: Fri, 7 Feb 1992 03:51:20 GMT
  978. Organization: University of Auckland, New Zealand.
  979.  
  980. Any one else found that the Think C debugger often crashes
  981. when it starts up and quits?  It might just be my buggy software
  982. stomping on things it shouldn't, but it seems to happen to
  983. me all the time :-(
  984.  
  985. It seems to crash mostly when I have saved watch points/variables
  986. and the change the source files they are in. (It also crashes
  987. when I hold down Shift and Option to skip these.)  I generally
  988. try to avoid leaving variables that point to odd/invalid addresses
  989. lying around, but the Debugger normally catches these safely anyway.
  990.  
  991. Also when I use a Classic and hold down the Command key when
  992. the Debugger starts up it gives me a user break in the debugger.
  993. This might be a valid and useful feature, but then why does it
  994. NOT do it on other machines.
  995.  
  996. Once I quit my application and it crashed badly in the Debugger when
  997. it quit. Unfortunately my boss was *watching* at the time
  998. -- hitting the RESET button when you quit the does not inspire 
  999. confidence.  (Well MacsBugs said it was the Debugger, and my
  1000. app's windows had disappeared.)
  1001.  
  1002. The upgrades to from 5.0 to 5.0.1 and then 5.0.2 did not help matters.
  1003. (Though I have never had these troubles with version 4.0.x, however.)
  1004.  
  1005. Any pointers to what I am doing wrong appreciated...
  1006. - -----------------------------------------------------------
  1007. Russell Street                     russells@ccu1.aukuni.ac.nz 
  1008. "Baldrick, I believe the phrase rhymes with 'clucking bell'."
  1009.         -- Edmund Blackadder
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015. - -------------------------
  1016.  
  1017. From: russotto@eng.umd.edu (Matthew T. Russotto)
  1018. Subject:  Buggy Think C debugger?
  1019. Date: Fri, 07 Feb 92 15:05:54 GMT
  1020. Organization: University of Maryland, College Park, College of Engineering
  1021.  
  1022. In article <1992Feb7.035120.4536@ccu1.aukuni.ac.nz> russells@ccu1.aukuni.ac.nz (Russell Street) writes:
  1023. >Any one else found that the Think C debugger often crashes
  1024. >when it starts up and quits?  It might just be my buggy software
  1025. >stomping on things it shouldn't, but it seems to happen to
  1026. >me all the time :-(
  1027.  
  1028. No, but I DO have it crash quite often if I start it up and immediately hit
  1029. Command-I (to bring up the appropriate source file).
  1030. The debugger and Think C both hang, and attempts to force quit result in a
  1031. locked up cursor.
  1032.  
  1033. This is with THINK C 5.0.2 on a Mac II running System 7.0.1* with Mode32 and
  1034. 20MB of VM.
  1035. -- 
  1036. Matthew T. Russotto    russotto@eng.umd.edu    russotto@wam.umd.edu
  1037. Your superior intellect is no match for our puny weapons! -- The Simpsons
  1038. Just say NO to police searches and seizures.  Make them use force.
  1039. (not responsible for bodily harm resulting from following above advice)
  1040.  
  1041.  
  1042.  
  1043. ---------------------------
  1044.  
  1045. From: philip@concave.cs.wits.ac.za (Philip Machanick)
  1046. Subject: Assemblers?
  1047. Date: 7 Feb 92 11:51:41 GMT
  1048. Organization: Wits Univ. Computer Science Dept.
  1049.  
  1050. I need an assembler that will run comfortably on SEs without
  1051. hard disks. Consulair M68000 assembler seems to be about right,
  1052. except the version I bought early last year seemed old and had
  1053. a number of irritating bugs. I am aware that THINK C supports
  1054. embedded assembly language, but that's too expensive for my
  1055. budget (and probably needs a hard disk anyway).
  1056.  
  1057. Does anyone have a phone / fax number for Consulair? The numbers
  1058. on the disks seem to be out of date. Alternatively, information
  1059. about other lightweight assemblers would be useful. (This is for
  1060. a course on assembly language programming - no need for strong
  1061. toolbox support etc. - just a good solid assembler that doesn't
  1062. need a hard disk.)
  1063.  
  1064. Any other ideas on this would be appreciated.
  1065. -- 
  1066. Philip Machanick                   philip@concave.cs.wits.ac.za
  1067. Department of Computer Science, University of the Witwatersrand
  1068. 2050 Wits, South Africa
  1069. phone 27(11)716-3759 fax 27(11)403-1926
  1070.  
  1071.  
  1072.  
  1073. - -------------------------
  1074.  
  1075. From: jahnke@joplin.biosci.arizona.edu (Jerome Jahnke)
  1076. Subject:  Assemblers?
  1077. Date: 7 Feb 92 21:21:00 GMT
  1078. Organization: Biology Learning Center
  1079.  
  1080. In article <1992Feb7.115141.9811@shannon.ee.wits.ac.za>, philip@concave.cs.wits.ac.za (Philip Machanick) writes:
  1081. > I need an assembler that will run comfortably on SEs without
  1082. > hard disks. Consulair M68000 assembler seems to be about right,
  1083. > except the version I bought early last year seemed old and had
  1084. > a number of irritating bugs. I am aware that THINK C supports
  1085. > embedded assembly language, but that's too expensive for my
  1086. > budget (and probably needs a hard disk anyway).
  1087. >
  1088.  
  1089. I used to use MacAssembly, and it worked for the longest time, and 
  1090. I did not know how good I had it until I bought the Consulair product
  1091. and well, I got so upset that I bought MPW. MacAssembly was a share-
  1092. ware product. I do know that the author got upset and stopped working
  1093. on it, but if you root around enough you should find it. It is a nice
  1094. Assembler and will run just fine on a floppy system.
  1095.  
  1096. > -- 
  1097. > Philip Machanick                   philip@concave.cs.wits.ac.za
  1098. > Department of Computer Science, University of the Witwatersrand
  1099. > 2050 Wits, South Africa
  1100. > phone 27(11)716-3759 fax 27(11)403-1926
  1101.  
  1102. Jer,
  1103. - --
  1104. Jerome Jahnke
  1105. Biology Learning Center
  1106. University of Arizona
  1107. 'jahnke@biosci.arizona.edu' or +1 (602) 621-3820
  1108.  
  1109.  
  1110.  
  1111. ---------------------------
  1112.  
  1113. From: heksterb@cs.utwente.nl (Ben Hekster)
  1114. Subject: How to get address of (not pointer to) member function
  1115. Date: 22 Jan 92 11:31:06 GMT
  1116. Organization: University of Twente, Dept. of Computer Science
  1117.  
  1118. How do you get the actual address of a nonstatic member function?
  1119. Not the C++ `pointer to member function' but the straight C `pointer
  1120. to function'.  I need this to unload the code segment in which the
  1121. function resides.  For example,
  1122.  
  1123.     class X {
  1124.         virtual void f();    // unloads segment containing u()
  1125.         virtual void u();    // `UnLoad'able function
  1126.         };
  1127.  
  1128.  
  1129.  
  1130.     /*    X::f()
  1131.         Unload the code segment containing X::u()
  1132.     */
  1133.     void X::f() {
  1134.  
  1135.     // pointer to member function
  1136.     void (X::*pmf)() = &X::u;    // fine, but not what I need
  1137.  
  1138.     // pointer to function?
  1139.     void (*pf)() = (void (*)()) pmf;// anachronism
  1140.  
  1141.     // unload the segment
  1142.     UnloadSeg((void*) pf);        // needs the actual address
  1143.     }
  1144.  
  1145. That is, I can get the `pointer to member function', but all my
  1146. attempts (I've tried this in at least five different ways) either
  1147. do not compile or, like the above example, do not produce the
  1148. desired result.  In particular, in the code above, `pf' is not
  1149. the address of the function at all but something that looks like
  1150. an offset in the virtual function table.
  1151.  
  1152.     The problem gets worse when I try to get a pointer to one
  1153. particular of a set of overloaded functions.
  1154.  
  1155.     Conversion of `pointer to member function' to `pointer to
  1156. function' is an anachronism pointed out on the very last page of
  1157. the [ARM].  I can understand that "any use of the resulting pointer
  1158. is undefined", but I don't want to use it to call the function, I
  1159. just need the address.  Is there any `legal' way to do this?
  1160.  
  1161.     I'm using MPW CFront (v1.0, I think).
  1162.  
  1163. (I'm directing follow-ups to comp.lang.c++)
  1164. -- 
  1165. Ben `Hackster' Hekster            | sigblock(sigmask(SIGFLAME));
  1166. heksterb@cs.utwente.nl            | "Here we are now, entertain us"
  1167.  
  1168.  
  1169.  
  1170. - -------------------------
  1171.  
  1172. From: ksand@apple.com (Kent Sandvik)
  1173. Subject:  How to get address of (not pointer to) member function
  1174. Date: 24 Jan 92 20:21:48 GMT
  1175. Organization: MacDTS Mongols
  1176.  
  1177. In article <1992Jan22.113106.20285@cs.utwente.nl>, heksterb@cs.utwente.nl (Ben Hekster) writes:
  1178. > How do you get the actual address of a nonstatic member function?
  1179. > Not the C++ `pointer to member function' but the straight C `pointer
  1180. > to function'.  I need this to unload the code segment in which the
  1181. > function resides.  For example,
  1182. >     class X {
  1183. >         virtual void f();    // unloads segment containing u()
  1184. >         virtual void u();    // `UnLoad'able function
  1185. >         };
  1186.  
  1187. You can't use a virtual function for UnloadSeg(). This because
  1188. the entry is really an offset to the vtable function ptr (4 byte value).
  1189.  
  1190. The way to fix this is to add - sigh - a dummy function in the same
  1191. segment, and use this one if you want to UnloadSeg() the particular
  1192. segment. Actually, if someone else has a better trick, please let us know.
  1193.  
  1194. I am working on a "MPW C++ Pitfalls" Tech Note which should address such
  1195. pesky issues. I don't know when it's released, I guess the label
  1196. RealSoonNow is a good estimate of the release date.
  1197.  
  1198. Kent the fake Sandvik
  1199. PS: Who forged me?
  1200.  
  1201.  
  1202.  
  1203. - -------------------------
  1204.  
  1205. From: dorner@pequod.cso.uiuc.edu (Steve Dorner)
  1206. Subject:  How to get address of (not pointer to) member function
  1207. Date: 24 Jan 92 21:28:19 GMT
  1208. Organization: University of Illinois at Urbana-Champaign
  1209.  
  1210. ksand@apple.com (Kent Sandvik) writes:
  1211. >The way to fix this is to add - sigh - a dummy function in the same
  1212. >segment, and use this one if you want to UnloadSeg() the particular
  1213. >segment. Actually, if someone else has a better trick, please let us know.
  1214.  
  1215. I found that sometimes when I resegmented my program I'd forget to change
  1216. the function names in my segment unloader.  So, I wrote a little perl
  1217. script (here's your chance to try the MPW perl announced a little while
  1218. ago).
  1219.  
  1220. You invoke it with all your source files as arguments.  It looks for segment
  1221. directives, puts a dummy routine in each segment, and writes a complete
  1222. segment unloader source file on stdout.
  1223.  
  1224. #!/usr/local/bin/perl
  1225. while (<>)
  1226. {
  1227.   if (/^#pragma segment/)
  1228.   {
  1229.     chop;
  1230.     split;
  1231.     if ($_[2] ne "Main")
  1232.     {
  1233.       $seglist{$_[2]} = $_[2];
  1234.     }
  1235.   }
  1236. }
  1237.  
  1238. print '#pragma load "declarations.load"\n';
  1239. foreach $seg (keys(%seglist))
  1240. {
  1241.   printf "#pragma segment %s\n",$seg;
  1242.   printf "void __Seg%s(void);\n",$seg;
  1243.   printf "void __Seg%s(void){}\n",$seg;
  1244. }
  1245. print <<"EOF";
  1246. #pragma segment Main
  1247. void UnloadSegments(void)
  1248. {
  1249.   extern void _DataInit();
  1250.   extern char *strchr();
  1251.   UnloadSeg(_DataInit);
  1252.   UnloadSeg(strchr);
  1253. EOF
  1254. foreach $seg (keys(%seglist))
  1255. {
  1256.   printf "  UnloadSeg(__Seg%s);\n",$seg;
  1257. }
  1258. print "}\n";
  1259. -- 
  1260. Steve Dorner, U of Illinois Computing Services Office
  1261. Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner
  1262. Apparently-To: does more harm than good.
  1263.  
  1264.  
  1265.  
  1266. - -------------------------
  1267.  
  1268. From: ksand@apple.com (Kent Sandvik)
  1269. Subject:  How to get address of (not pointer to) member function
  1270. Date: 24 Jan 92 20:21:48 GMT
  1271. Organization: MacDTS Mongols
  1272.  
  1273. In article <1992Jan22.113106.20285@cs.utwente.nl>, heksterb@cs.utwente.nl (Ben Hekster) writes:
  1274. > How do you get the actual address of a nonstatic member function?
  1275. > Not the C++ `pointer to member function' but the straight C `pointer
  1276. > to function'.  I need this to unload the code segment in which the
  1277. > function resides.  For example,
  1278. >     class X {
  1279. >         virtual void f();    // unloads segment containing u()
  1280. >         virtual void u();    // `UnLoad'able function
  1281. >         };
  1282.  
  1283. You can't use a virtual function for UnloadSeg(). This because
  1284. the entry is really an offset to the vtable function ptr (4 byte value).
  1285.  
  1286. The way to fix this is to add - sigh - a dummy function in the same
  1287. segment, and use this one if you want to UnloadSeg() the particular
  1288. segment. Actually, if someone else has a better trick, please let us know.
  1289.  
  1290. I am working on a "MPW C++ Pitfalls" Tech Note which should address such
  1291. pesky issues. I don't know when it's released, I guess the label
  1292. RealSoonNow is a good estimate of the release date.
  1293.  
  1294. Kent the fake Sandvik
  1295. PS: Who forged me?
  1296.  
  1297.  
  1298.  
  1299. ---------------------------
  1300.  
  1301. From: wwg2101@summa.tamu.edu (GILPIN, W.W.)
  1302. Subject: How to hang up on a User
  1303. Date: 23 Jan 92 04:12:00 GMT
  1304. Organization: Texas A&M University, Academic Computing Services
  1305.  
  1306. I am writing a BBS program and am at the point where I need to be able to hang
  1307. up on a user after a timeout, or deal with a lost carrier, no matter where
  1308. in the program the user is(Well, actually it only checks at the prompts, but
  1309. I'll get into that later). What I need help with is how to return from all
  1310. the procedure calls the user is in at the time to keep from overflowing that
  1311. stack. Here's how it would look:
  1312.  
  1313. Main-->BBS-->SubBoards-->PostMessage-->Editor-->GetLine
  1314. (sample nested function names for a user logged on and posting a message)
  1315.  
  1316. GetLine can detect when a user has dropped carrier or has timed out and can
  1317. hang up the phone. Now what I need to do is zip all the way back to Main and
  1318. reset the BBS.
  1319.  
  1320. My Idea:Use a global flag variable. (i.e. UserGone). Normally False. GetLine
  1321. sets it to true if timeout or no carrier. Each call of GetLine must have a 
  1322. check for this flag upon return and then jumps to the end of the function
  1323. if it's true. Then each procedure call that could possibly include a GetLine
  1324. call must also have this check so it could make it back to the beginning.
  1325.  
  1326. This seems amazingly complex and Kludgy. Do any of you programming Gurus out
  1327. there have any ideas on how this can be done more simply, or will I be forced
  1328. to double up on all of my function calls? 
  1329.  
  1330. Wes Gilpin
  1331. WWG2101@TAMZEUS
  1332. WWG2101@ZEUS.TAMU.EDU
  1333.  
  1334.  
  1335.  
  1336. - -------------------------
  1337.  
  1338. From: scott@phylo.life.uiuc.edu (| particle man |)
  1339. Subject:  How to hang up on a User
  1340. Date: 23 Jan 92 18:19:18 GMT
  1341. Organization: University of Illinois at Urbana
  1342.  
  1343.  
  1344. This may not answer your question, but why don't you just invert DTR
  1345. and make sure that your users' modems are configured properly to 
  1346. handle it by shouting it at the top of your lungs in your docs?
  1347.  
  1348.  
  1349. --
  1350.  
  1351.     "Laugha while you cana, Monkey Boy!" -Emilio Lizardo
  1352.  
  1353.  
  1354.  
  1355. - -------------------------
  1356.  
  1357. From: nick@vaila.ed.ac.uk (Nick Rothwell)
  1358. Subject:  How to hang up on a User
  1359. Date: 23 Jan 92 11:47:12 GMT
  1360. Organization: Laboratory for Foundations of Computer Science.
  1361.  
  1362. In article <22JAN199223125881@summa.tamu.edu> wwg2101@summa.tamu.edu (GILPIN, W.W.) writes:
  1363.  
  1364.    GetLine can detect when a user has dropped carrier or has timed out and can
  1365.    hang up the phone. Now what I need to do is zip all the way back to Main and
  1366.    reset the BBS.
  1367.  
  1368. What's wrong with longjmp()?
  1369.  
  1370.     Nick.
  1371. --
  1372. Nick Rothwell, LFCS, Edinburgh | Performance: A-11  FANCY-SIGNATURE   [COMPARE]
  1373.              nick@dcs.ed.ac.uk | Key Mode: ZONE **  MIDI-Sep-Ch: Off Split: C#4
  1374. Mentation Consultancy Services | Upper: a-34 LOUD.SIGNATURE  FX1: QuadChorus+EQ
  1375.    cassiel@cix.compulink.co.uk | Lower: b-11 DISCLAIMERVOIC  FX2: Vocoder/Delay
  1376.  
  1377.  
  1378.  
  1379. - -------------------------
  1380.  
  1381. From: d88-jwa@hemul.nada.kth.se (Jon W{tte)
  1382. Subject:  How to hang up on a User
  1383. Date: 24 Jan 92 15:15:38 GMT
  1384. Organization: Royal Institute of Technology, Stockholm, Sweden
  1385.  
  1386. .ac.uk> nick@vaila.ed.ac.uk (Nick Rothwell) writes:
  1387.  
  1388.       GetLine can detect when a user has dropped carrier or has timed out
  1389.       and can hang up the phone. Now what I need to do is zip all the way
  1390.       back to Main and reset the BBS.
  1391.  
  1392.    What's wrong with longjmp()?
  1393.  
  1394. Allocated memory, opened files, started transactions, queued events,
  1395. asynchronous I/O, ... for instance.
  1396.  
  1397. It's usually much better to use an error return code for each function.
  1398. You _could_ use longjmp, but that'd need wrappers for all files you open,
  1399. all memory you allocate, all application-dependent data structures, ...
  1400. so you could reset/close/free all of these after the longjmp.
  1401.  
  1402.  
  1403. --
  1404. This Signature is distributed under the conditions of the Signature License,
  1405. available at a fee from   h+@nada.kth.se  (Jon W{tte)  Reading the Signature
  1406. implies that you accept to be bound by the terms in said License. Should you
  1407. not agree on any of these terms, you must return the Signature unread to me.
  1408.  
  1409.  
  1410.  
  1411. - -------------------------
  1412.  
  1413. From: greggor@Apple.COM (Greg L. Anderson)
  1414. Subject:  How to hang up on a User
  1415. Date: 24 Jan 92 20:54:17 GMT
  1416. Organization: Apple Computer Inc., Cupertino, CA
  1417.  
  1418. Some unquoted user asked:
  1419. >   What's wrong with longjmp()?
  1420.  
  1421. In article <D88-JWA.92Jan24161538@hemul.nada.kth.se> d88-jwa@hemul.nada.kth.se (Jon W{tte) writes:
  1422. >Allocated memory, opened files, started transactions, queued events,
  1423. >asynchronous I/O, ... for instance.
  1424. >It's usually much better to use an error return code for each function.
  1425.  
  1426. Yes, but that's _so_ painful; it involves way too many if statements.
  1427.  
  1428. >You _could_ use longjmp, but that'd need wrappers for all files you open,
  1429. >all memory you allocate, all application-dependent data structures, ...
  1430. >so you could reset/close/free all of these after the longjmp.
  1431.  
  1432. Now you're giving good advice.  Failure handlers are not hard to
  1433. write, and I think there has been at least one package published in
  1434. d e v e l o p  (although offhand I don't know if that's true or
  1435. not).
  1436.  
  1437. I have a set of setjmp/longjmp based failure routines, if anyone is
  1438. interested.  It was written for Think C, but should work in other
  1439. environments too.
  1440.  
  1441. -- 
  1442. =====================   ===========================   =====================
  1443. Greg Anderson           Apple Computer, Inc.            O    Ponnuki    O
  1444. Macintosh Bodhisattva   Developer Tools Engineering    O O  is  ideal  O O
  1445. greggor@apple.com       Apple Developer Suite           O     shape     O
  1446. =====================   ===========================   =====================
  1447.  
  1448.  
  1449.  
  1450. - -------------------------
  1451.  
  1452. From: plogan@mentorg.com (Patrick Logan)
  1453. Subject:  How to hang up on a User
  1454. Date: 25 Jan 92 01:21:42 GMT
  1455. Organization: Mentor Graphics Corporation
  1456.  
  1457.  
  1458.    From: greggor@Apple.COM (Greg L. Anderson)
  1459.    >You _could_ use longjmp, but that'd need wrappers for all files you open,
  1460.    >all memory you allocate, all application-dependent data structures, ...
  1461.    >so you could reset/close/free all of these after the longjmp.
  1462.  
  1463.    Now you're giving good advice.  Failure handlers are not hard to
  1464.    write, and I think there has been at least one package published in
  1465.    d e v e l o p  (although offhand I don't know if that's true or
  1466.    not).
  1467.  
  1468.    I have a set of setjmp/longjmp based failure routines, if anyone is
  1469.    interested.  It was written for Think C, but should work in other
  1470.    environments too.
  1471.  
  1472. I developed something similar using Aztec C a long time ago, based on
  1473. CommonLISP's CATCH, THROW, and UNWIND-PROTECT. It was trivial to
  1474. implement.
  1475.  
  1476. Watch out if you're using C++, though! (Obviously?)
  1477. -- 
  1478. Patrick Logan, plogan@mentorg.com,
  1479. Voice: (503) 685-7000 x2907, FAX: (503) 685-1282
  1480. Mentor Graphics Corp., Bldg. C, 8005 SW Boeckman Rd., Wilsonville, OR 97070
  1481. I can't gete the .signature virus and I can't gete the .signature
  1482.  
  1483.  
  1484.  
  1485. - -------------------------
  1486.  
  1487. From: greggor@Apple.COM (Greg L. Anderson)
  1488. Subject:  How to hang up on a User
  1489. Date: 24 Jan 92 20:54:17 GMT
  1490. Organization: Apple Computer Inc., Cupertino, CA
  1491.  
  1492. Some unquoted user asked:
  1493. >   What's wrong with longjmp()?
  1494.  
  1495. In article <D88-JWA.92Jan24161538@hemul.nada.kth.se> d88-jwa@hemul.nada.kth.se (Jon W{tte) writes:
  1496. >Allocated memory, opened files, started transactions, queued events,
  1497. >asynchronous I/O, ... for instance.
  1498. >It's usually much better to use an error return code for each function.
  1499.  
  1500. Yes, but that's _so_ painful; it involves way too many if statements.
  1501.  
  1502. >You _could_ use longjmp, but that'd need wrappers for all files you open,
  1503. >all memory you allocate, all application-dependent data structures, ...
  1504. >so you could reset/close/free all of these after the longjmp.
  1505.  
  1506. Now you're giving good advice.  Failure handlers are not hard to
  1507. write, and I think there has been at least one package published in
  1508. d e v e l o p  (although offhand I don't know if that's true or
  1509. not).
  1510.  
  1511. I have a set of setjmp/longjmp based failure routines, if anyone is
  1512. interested.  It was written for Think C, but should work in other
  1513. environments too.
  1514.  
  1515. -- 
  1516. =====================   ===========================   =====================
  1517. Greg Anderson           Apple Computer, Inc.            O    Ponnuki    O
  1518. Macintosh Bodhisattva   Developer Tools Engineering    O O  is  ideal  O O
  1519. greggor@apple.com       Apple Developer Suite           O     shape     O
  1520. =====================   ===========================   =====================
  1521.  
  1522.  
  1523.  
  1524. ---------------------------
  1525.  
  1526. End of C.S.M.P. Digest
  1527. **********************
  1528.